#include "p.h"
const char BODY = '=';                                                                        
const char RIGHT = '>';
char s[102];
int pre = 0,i=0;
const char* d="+x";

void processBar(int rate){
  if(rate == pre) return;
  pre = rate;
  for(int i=0;i<rate;++i) s[i] = BODY;
  if(rate!=100)s[rate-1] = RIGHT;
  printf("[%-100s][%d%%][%c]\r",s,rate,d[i^=1]);
  fflush(stdout);
  if(rate==100) printf("\n");
}

void clear(){
  pre = 0;
  memset(s,'\0',sizeof(s));
}
